/**
 * mock 配置
 * @author 杨世峰
 */


import Mock from "mockjs";

import userBasicMock from './user/userBasicMock'
import bookletMock from './user/bookletMock'
import userInfoMock from "./administrator/userInfoMock";
import functionMock from "./administrator/functionMock";

// 设置延迟
Mock.setup({ timeout: '1000-2000' })

const mockUserBasic = false



if (mockUserBasic) {
    // 对 register 请求返回 userBasicMock.registerSuccess() 函数所返回的字段
    // Mock.mock('http://localhost:8080/v1/users', 'post' , userBasicMock.regiserFail)
    // Mock.mock('/api/users', 'put' , userBasicMock.loginFail)
    Mock.mock(/\/api\/users\/\d/, 'get', userBasicMock.getSuccessUserInfo)  // /api/users/{userId}
    Mock.mock(/\/api\/users\/userId/, 'put', userBasicMock.modyfyUserINfoSuccess)   // /api/users/userId

    Mock.mock(/\/api\/booklets\/(\d)(|\?\s*)/, 'get', bookletMock.getBooklets)
    Mock.mock(/\/api\/words\/(\w)/, 'get', bookletMock.getWord)

    


    Mock.mock('/api/admin/users?page=1&pageSize=3', 'get' , userInfoMock.getUserList)//获取用户列表
    Mock.mock('/api/admin/users/user', 'get', userInfoMock.getUserInfo)//查看用户详细信息
    Mock.mock(/\/api\/admin\/users\/\d/, 'put', userInfoMock.updateUserInfoSuccess)//修改用户信息成功
    Mock.mock('/api/admin/functions?page=1&pageSize=3', 'get',functionMock.getFunctionList )//查看所有功能
    Mock.mock(/\/api\/admin\/functions\/\d/, 'put', functionMock.functionStatusChange)//修改功能状态成功


}
